/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simplemetrosystem.view.action;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import simplemetrosystem.control.EditCommandManager;
import simplemetrosystem.model.charlanguage.NameMap;
import simplemetrosystem.view.MetroFrame;

/**
 *
 * @author Eric Qian
 */
public class NewLineActionListener implements ActionListener {

    /**
     * 
     * @param frame
     */
    public NewLineActionListener(MetroFrame frame) {
        this.frame = frame;
        nameMap = NameMap.getInstance();
    }

    public void actionPerformed(ActionEvent e) {
        System.out.println("New Line");
        String input = JOptionPane.showInputDialog(frame, nameMap.getName("Line Name(English)"),
                nameMap.getName("New Line"), JOptionPane.PLAIN_MESSAGE);
        if (!(input == null || input.equals(""))) {
            EditCommandManager.getInstance().addLine(input);
        }
    }
    private NameMap nameMap;
    private MetroFrame frame;
}
